var uploadFile = function (client, inputFile) {
  var file = inputFile[0].files[0];
  if (!uploadFileClient || Object.keys(uploadFileClient).length === 0) {
    uploadFileClient = client;
  }
  //取出文件后缀
  var fileName = file.name;
  var fileSize = file.size;
  var pos = fileName.lastIndexOf(".");
  var suffix = (pos >= 0) ? fileName.substring(pos) : "";
  let options = {
    progress,//这里的progress是上传进度的方法，用于更新进度条和获取当前的上传进度，下面会有介绍
    partSize: 500 * 1024,//分片的大小
    timeout: 60000
  };
  upload_oss.fileKey += suffix;
  upload_oss.fileUrl += suffix;
  uploadFileClient.listUploads({"prefix":upload_oss.fileKey}).then(res=> {
    if(res.nextUploadIdMarker){
      let theCheckPoint = JSON.parse(localStorage.getItem(ossMd5(fileName+fileSize)));

      currentCheckpoint = theCheckPoint;
      currentCheckpoint.file = file;
    }
    if (currentCheckpoint) {
      options.checkpoint = currentCheckpoint;
    }
    return uploadFileClient.multipartUpload( upload_oss.fileKey, file,options).then(function (uploadRes) {
      if(currentCheckpoint){
        localStorage.removeItem(ossMd5(currentCheckpoint.file.name+currentCheckpoint.file.size))
      }
      currentCheckpoint = null;
      uploadFileClient = null;
      client_callback.pushUrl(upload_oss, inputFile, uploadRes);
    }).catch((err) => {
      if (uploadFileClient && uploadFileClient.isCancel()) {
        console.log('stop-upload!');
      } else {
        console.error(err);
        console.log(`err.name : ${err.name}`);
        console.log(`err.message : ${err.message}`);
        if (err.name.toLowerCase().indexOf('connectiontimeout') !== -1) {
          // timeout retry
          if (retryCount < retryCountMax) {
            retryCount++;
            console.error(`retryCount : ${retryCount}`);
            uploadFile('');
          }
        }
      }
    });
  });
};
